﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Kotonoha.Server.Extensions {
    public static class Enumerable{
        public static bool IsEmpty<T>(this IEnumerable<T> param) {
            return param == null || param.Count() == 0;
        }

        public static void ForEach<T>(this IEnumerable<T> param, Action<T> fnc) {
            foreach (T t in param) {
                fnc(t);
            }
        }

        public static void ForEach<T>(this IEnumerable<T> param, Action<T, int> fnc) {
            int i = 0;
            foreach (T t in param) {
                fnc(t, i);
                ++i;
            }
        }
    }
}
